feat: Add built-in PostgreSQL geometric types support (#282) - #3156
Open
kAif-gh wants to merge 1 commit into
Open
feat: Add built-in PostgreSQL geometric types support (#282)#3156kAif-gh wants to merge 1 commit into
kAif-gh wants to merge 1 commit into
Conversation
kAif-gh
force-pushed
the
feat/postgis-geometry-282
branch
from
August 4, 2026 16:28
29549f2 to
f8b857e
Compare
Member
|
https://github.com/SeaQL/.github/blob/master/AI_POLICY.md We should not directly depend on sqlx types. Newtype wrapper is not a good idea. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add support for built-in PostgreSQL geometric types
Closes #282
What
Adds support for PostgreSQL's built-in geometric types in entities:
point,line,lseg,box,path,polygon,circle.These are the core Postgres geometric types (Postgres manual §8.8) — not
PostGIS, so no extension is required.
How
sqlx already provides structs for these types (
PgPoint,PgPolygon, …), butRust's orphan rules stop us from implementing sea-orm's traits on them directly.
So this adds a thin
Geo<T>newtype wrapper that implements the needed traits(
ValueType,TryGetable,Nullable,IntoActiveValue, …) and derefs to theinner sqlx type.
Values cross the DB boundary as canonical Postgres text using the existing
save_as/select_ascasts, so the coreValueenum is left unchanged.Everything is gated behind a new
postgres-geometryfeature.Usage
Tests
Adds
tests/postgres_geometry_tests.rscovering insert/select round-trips of allseven types (including a NULL case) and native spatial queries (
@>,<->).cargo test --features sqlx-postgres,postgres-geometry --test postgres_geometry_tests